package org.smartagents.util;

import org.smartagents.body.BrainBuilder;
import org.smartagents.body.Neurone;
import org.smartagents.body.Substance;
import org.smartagents.body.SubstanceFactory;
import org.smartagents.enviro.EnvironmentConstants;

public class CreatureTemplates {


    public static String getBlindExplorer() {

        Neurone cortex = new Neurone();


        String cortexCode = cortex.getCode();

        Substance move_muscle = SubstanceFactory.getSubstance("move muscle", -1, "M.*", "M");
        Substance reset = SubstanceFactory.getSubstance("reset", 1, null, "R");
        Substance rotate_muscle = SubstanceFactory.getSubstance("rotate_muscle", -1, "Rot.*", "Rot");

        Substance counter_rotator = SubstanceFactory.getSubstance("counter1", 3, null, "CN,Rot.*");
        Substance counter_mover = SubstanceFactory.getSubstance("counter2", 1, null, "CN,M");

        String organism =
                move_muscle.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        reset.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        rotate_muscle.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        counter_rotator.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        counter_mover.toString() +
                        EnvironmentConstants.BODY_BRAIN_SEPARATOR +
                        cortexCode;

        return organism;
    }

    public static String getEye() {
        Neurone cortex = new Neurone();

        Neurone n2 = BrainBuilder.buildNeurone("E.*_M.*");
        n2.addLink(cortex);

        cortex.addLink(n2);


        String cortexCode = cortex.getCode();

        Substance sub1 = SubstanceFactory.getSubstance("EYE1", 1, null, "E,1,15");
        Substance sub2 = SubstanceFactory.getSubstance("MUSCLE1", -1, "M.*", "M");
        Substance sub3 = SubstanceFactory.getSubstance("RESETER1", 1, null, "R");
        Substance sub4 = SubstanceFactory.getSubstance("ROTATOR", 20, null, "Rot");


        System.out.println(sub1.toString());
        System.out.println(sub2.toString());
        System.out.println(sub3.toString());


        //String organism1 = "muscle&2&&M%eye&5&&E-1-3="+cortexCode;
        String organism1 =
                sub1.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        sub2.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        sub3.toString() +
                        EnvironmentConstants.SUBSTANCE_SEPARATOR +
                        sub4.toString() +
                        EnvironmentConstants.BODY_BRAIN_SEPARATOR +
                        cortexCode;
        return organism1;
    }

}
